home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Tools / MPW / gawk 2.11.1r3 / Sources / stat.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-28  |  2.3 KB  |  89 lines  |  [TEXT/MPS ]

  1. /*********************************************************************
  2. File        :    stat.h            -    Macintosh implementation of stat()
  3. Author    :    Matthias Neeracher
  4. Started    :    28May91                                Language    :    MPW C
  5.                 28May91    MN    Created
  6.                 28May91    MN    isatty()
  7. Last        :    28May91
  8.  
  9. Copyright (c) 1991, Matthias Neeracher
  10.  
  11. Permission is granted to anyone to use this software for any
  12. purpose on any computer system, and to redistribute it freely,
  13. subject to the following restrictions:
  14.  
  15. 1. The author is not responsible for the consequences of use of
  16.     this software, no matter how awful, even if they arise
  17.     from defects in it.
  18.  
  19. 2. The origin of this software must not be misrepresented, either
  20.     by explicit claim or by omission.
  21.  
  22. 3. Altered versions must be plainly marked as such, and must not
  23.     be misrepresented as being the original software.
  24.  
  25. *********************************************************************/
  26.  
  27. /* We try to be as conformant as possible with the UNIX specification
  28.     of stat(2) according to the SunOS 3.0 manpage. Pathnames are, however,
  29.     Macintosh-style (with ':' as a directory separator). This code
  30.     is not A/UX compatible and doesn't know about System 7 aliases
  31.     (because it's author doesn't know, either :-) and AppleTalk access
  32.     rights (too complicated right now).
  33. */
  34.  
  35. #include <time.h>
  36.  
  37. typedef unsigned short     u_short;
  38. typedef long                off_t;
  39. typedef short                dev_t;
  40. typedef long                ino_t;
  41.  
  42. /* mode information */
  43.  
  44. #define S_IFMT        0170000
  45. #define  S_IFDIR    0040000
  46. #define    S_IFCHR    0020000
  47. #define    S_IFBLK    0060000
  48. #define    S_IFREG    0100000
  49. #define    S_IFLNK    0120000
  50. #define    S_IFSOCK    0140000
  51.  
  52. #define S_ISUID    0004000
  53. #define S_ISGID    0002000
  54. #define S_ISVTX    0001000
  55. #define S_IREAD    0000400
  56. #define S_IWRITE    0000200
  57. #define S_IEXEC    0000100
  58.  
  59. /* Group and others permission is same as owner */
  60.  
  61. struct stat    {
  62.     dev_t        st_dev;        /* Set to vol. refNum.     */
  63.     ino_t        st_ino;        /* Set to file ID          */
  64.     u_short    st_mode;
  65.     short        st_nlink;    /* Always 1                    */
  66.     short        st_uid;        /* Set to 0                    */
  67.     short        st_gid;        /* Set to 0                    */
  68.     dev_t        st_rdev;        /* Set to 0                    */
  69.     off_t        st_size;
  70.     time_t    st_atime;    /* Set to st_mtime         */
  71.     time_t    st_mtime;
  72.     time_t    st_ctime;
  73.     long        st_blksize;
  74.     long        st_blocks;
  75. };
  76.  
  77. #ifdef __cplusplus
  78. extern "C" {
  79. #endif
  80.  
  81. int    stat(char * path, struct stat * buf);
  82. int    lstat(char * path, struct stat * buf);
  83. int    fstat(int fd, struct stat * buf);
  84. int    isatty(int);
  85.  
  86. #ifdef __cplusplus
  87. }
  88. #endif
  89.